package com.bd03.streaminglearn.day0326

import redis.clients.jedis.Jedis

object RedisDemo {
  def main(args: Array[String]): Unit = {
    val jedis = new Jedis("hdp01")
    jedis.select(2)//更换库
   // val str = jedis.get("name")//取值
    //jedis.set("age","22")
   // jedis.del("age")
    //jedis.set("age","23")
   //jedis.incr("age")
    //jedis.incrBy("age",22)
    jedis.hset("stu","name","xiaoming")
    jedis.hset("stu","word","1")

    println(jedis.hget("stu", "name"))
    jedis.hincrBy("stu","word",22)

    jedis.expire("stu",10)//设置key的有效时间

    jedis.close()


  }
}
